package classTest.HomeWorkday07;

import sun.security.krb5.internal.Ticket;

import javax.management.NotificationEmitter;
 class Test implements Runnable{
    private  int m =1000;
    public void run(){
      while (true){
          if (m==0){
              break;
          }else {
              m--;
              System.out.println(Thread.currentThread().getName()+"剩余"+m+"张");
             /* try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }*/
          }
      }
    }



    public static void main(String[] args) {
        Runnable test=new Test();

        Thread thread1=new Thread(test);
        Thread thread2=new Thread(test);
        Thread thread3=new Thread(test);
        thread1.setName("窗口1");
        thread2.setName("窗口2");
        thread3.setName("窗口3");
         thread1.start();
        thread2.start();
        thread3.start();
    }

}

